'use strict'

class add {
  constructor() {
    this.param = '/'
  }

  async get(c) {
    let a = c.service.fun;

    c.setHeader('content-type', 'text/html; charset=utf-8')
    let worddata =await a.sel('source_word_list','',["source_word_txt"],c.service.pool);
    let imgdata = await a.sel('source_img_list','',["source_img_img"],c.service.pool)
    //console.log(worddata.rows)
    let words = [],imgs = [];
    for(var i = 0;i < worddata.rows.length;i++){
      let {source_word_txt} = worddata.rows[i];
      words.push(source_word_txt);
    }
    for(var j = 0;j < imgdata.rows.length;j++){
      let {source_img_img} = imgdata.rows[j];
      imgs.push(source_img_img);
    }
    let data = [words,imgs];
    c.send({
      type:'array',
      data:data
    })
  }

}

module.exports = add;

